import 'package:flutter/material.dart';
// import '../../PS_Tools/PS_CustomSize.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../tools/KaL_Config.dart';

// import '../../PS_Tools/PS_Language/PS_StringModel.dart';

class EJ_YDContactusVC extends StatefulWidget {
  const EJ_YDContactusVC({Key? key}) : super(key: key);

  @override
  State<EJ_YDContactusVC> createState() => _EJ_YDContactusVCState();
}

class _EJ_YDContactusVCState extends State<EJ_YDContactusVC> {
  //邮箱地址
  String PS_email = KaL_Config.KaL_feedbackEmail;

  PS_sendEmail() async {
    // // 收件人邮箱
    // String recipient = PS_email;
    // //邮件主题
    // String subject = "Theme";
    // // 邮件内容
    // String body = "Content";
    // String mailtoUri = "mailto:$recipient?subject=$subject&body=$body";
    // final Uri url = Uri.parse(mailtoUri);
    // if (!await launchUrl(url, mode: LaunchMode.externalApplication)) {
    //   throw Exception('Could not launch $mailtoUri');
    // }
    final Uri PS_emailLaunchUri = Uri(
      scheme: 'mailto',
      path: PS_email,
      queryParameters: {'subject': 'Hello', 'body': 'Hello Sir'},
    );
    await launchUrl(PS_emailLaunchUri);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        foregroundColor: KaL_Config.KaL_MainColor,
        centerTitle: true,
        title: const Text(
          'Contact us',
          style: TextStyle(fontWeight: FontWeight.bold),
        ),
      ),
      body: Container(
        color: KaL_Config.KaL_pageBgColor,
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(left: 15, top: 15, right: 15),
              padding: const EdgeInsets.only(
                  left: 10, right: 10, top: 10, bottom: 10),
              // height: 50.0,
              // color: Colors.white,
              child: const Text(
                'Contact us by following email if any questions/problems:',
                style: TextStyle(fontSize: 15, color: Colors.black),
              ),
            ),
            Container(
              // color: Colors.white,
              margin: const EdgeInsets.only(left: 15, right: 15),
              padding: const EdgeInsets.only(left: 10, right: 10, bottom: 10),
              alignment: Alignment.centerLeft,
              child: GestureDetector(
                child: Text(
                  PS_email,
                  style: TextStyle(color: KaL_Config.KaL_MainColor),
                ),
                onTap: () {
                  // debugPrint('ttp.gmail.com');
                  // launchUrl(Uri.parse('ttp.gmail.com'));
                  PS_sendEmail();
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
